<template>
  <div id="index">
    <baidu-map class="map" :center="center" :zoom="zoom" @ready="handler" />
    <div class="num3">
      <div class="pic"></div>
      <div class="name">电表数量</div>
      <div class="numm">{{assets}}</div>
    </div>
    <div class="num1">
      <div class="pic"></div>
      <div class="name">终端数量</div>
      <div class="numm">{{terminal}}</div>
    </div>
    <div class="num2">
      <div class="pic"></div>
      <div class="name">客户数量</div>
      <div class="numm">{{customer}}</div>
    </div>
  </div>
</template>

<script>
import { GetApi,AssetsAmmeterCount,AssetsTerminalCount,CustomerCount } from "../request/api.js";
export default {
  name: "Index",
  data() {
    return {
      center: { lng: 0, lat: 0 },
      zoom: 0,
      assets:'',
      terminal:'',
      customer:'',
    };
  },
  created() {
    GetApi().then((res) => {
      console.log(res);
    });
    AssetsAmmeterCount().then((res)=>{
      console.log(res);
      this.assets = res.data.data
    });
    AssetsTerminalCount().then((res)=>{
      this.terminal = res.data.data
    });
    CustomerCount().then((res)=>{
      this.customer = res.data.data
    })
  },
  mounted() {},
  methods: {
    handler({ BMap, map }) {
      console.log(BMap, map);
      this.center.lng = 123.40155950080872;
      this.center.lat = 41.76518229716872;
      this.zoom = 15;
    },
  },
};
</script>

<style scoped lang="less">
.map {
  width: 100%;
  height: calc(100vh - 160px);
  /deep/ div.BMap_cpyCtrl.BMap_noprint.anchorBL {
    display: none;
  }
  /deep/ div.anchorBL {
    display: none;
  }
}
.num3 {
  width: 200px;
  height: 80px;
  background-color: #fff;
  position: absolute;
  top: 100px;
  right: 100px;
  display: flex;
  align-items: center;
  .pic {
    width: 50px;
    height: 50px;
    background-color: #f3f3f3;
    border-radius: 50px;
    margin-left: 20px;
  }
  .name {
    margin: 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #008ecb;
  }
}
.num1 {
  width: 200px;
  height: 80px;
  background-color: #fff;
  position: absolute;
  top: 200px;
  right: 100px;
  display: flex;
  align-items: center;
  .pic {
    width: 50px;
    height: 50px;
    background-color: #f3f3f3;
    border-radius: 50px;
    margin-left: 20px;
  }
  .name {
    margin: 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #008ecb;
  }
}
.num2 {
  width: 200px;
  height: 80px;
  background-color: #fff;
  position: absolute;
  top: 300px;
  right: 100px;
  display: flex;
  align-items: center;
  .pic {
    width: 50px;
    height: 50px;
    background-color: #f3f3f3;
    border-radius: 50px;
    margin-left: 20px;
  }
  .name {
    margin: 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #008ecb;
  }
}
</style>
